# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1295 -> 1.1296 # mm/memory.c 1.131 -> 1.132 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/08/25 davidm@tiger.hpl.hp.com 1.1296 # Patch by Arun to make test-popseg.x86 work again: I've tracked this down to # mm/memory.c:do_no_page() dereferencing vma->vm_file. The problem is that # the vma used for mapping the GDT has vma->vm_ops->nopage, but vma->vm_file # is NULL. # # Andrew Morton agreed with this patch, but for some reason, it didn't make # it into 2.6.0-test4. # -------------------------------------------- # diff -Nru a/mm/memory.c b/mm/memory.c --- a/mm/memory.c Wed Aug 27 00:40:32 2003 +++ b/mm/memory.c Wed Aug 27 00:40:32 2003 @@ -1386,7 +1386,7 @@ unsigned long address, int write_access, pte_t *page_table, pmd_t *pmd) { struct page * new_page; - struct address_space *mapping; + struct address_space *mapping = NULL; pte_t entry; struct pte_chain *pte_chain; int sequence; @@ -1398,8 +1398,10 @@ pte_unmap(page_table); spin_unlock(&mm->page_table_lock); - mapping = vma->vm_file->f_dentry->d_inode->i_mapping; - sequence = atomic_read(&mapping->truncate_count); + if (vma->vm_file) { + mapping = vma->vm_file->f_dentry->d_inode->i_mapping; + sequence = atomic_read(&mapping->truncate_count); + } smp_rmb(); /* Prevent CPU from reordering lock-free ->nopage() */ retry: new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0); @@ -1435,7 +1437,8 @@ * invalidated this page. If invalidate_mmap_range got called, * retry getting the page. */ - if (unlikely(sequence != atomic_read(&mapping->truncate_count))) { + if (mapping && + (unlikely(sequence != atomic_read(&mapping->truncate_count)))) { sequence = atomic_read(&mapping->truncate_count); spin_unlock(&mm->page_table_lock); page_cache_release(new_page);